<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <script src="../js/lib/mdui.min.js"></script>
    <script src="../js/lib/jquery-3.2.1.slim.min.js"></script>
    <script src="../js/lib/holder.min.js"></script>
    <script src="../js/lib/highlight.pack.js"></script>
    <script src="../js/lib/mustache.js"></script>
    <script src="../js/lib/jquery.media.js"></script>
    <script src="../js/docs.js"></script>
    <script src="../js/init.js"></script>
    <link rel="stylesheet" href="../css/mdui.min.css">
    <link rel="stylesheet" href="../css/github-gist.css">
    <link rel="stylesheet" href="../css/railscasts.css">
    <link rel="stylesheet" href="../css/docs.css">
    <link rel="stylesheet" href="../css/mdui.min.css"/>
    <title>欢迎使用STdisk - 集中管理您的所有文件</title>
    <script>
    function register(){
    	window.location.href ='register.html';
    }
    
    
    function login(){
		let user = $("#username").val();
		let pwd = $("#pwd").val();
		$.ajax({
			url:"../api/checkidentity",
			type: "POST",
			data:{
				username:user,
				password:pwd,
				
			},
			dataType:"json",
			success:function (data){
				let code = data.code;
				if(code == 0){
					window.location.href = 'main.html';
				}
				else{
					mdui.alert('用户名或密码输入错误！');
				}
			}
		});
 	}
 
		</script>
</head>
<body class="mdui-theme-accent-pink mdui-loaded mdui-theme-primary-blue mdui-appbar-with-toolbar">
		<header class="mdui-appbar mdui-appbar-fixed">
	    <div class="mdui-toolbar mdui-color-theme">
	        <a href="#" class="mdui-typo-headline ">STdisk</a>
	        <div class="mdui-toolbar-spacer"></div>
	        <span class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white"
	              mdui-dialog="{target: '#dialog-docs-theme'}"
	              mdui-tooltip="{content: '设置主题'}"><i class="mdui-icon material-icons">color_lens</i>
	        </span>
	    </div>
		</header>
	
		<div class="mdui-container">
    
    	<div class="mdui-row ">
        <div class="mdui-shadow-2 mdui-col-offset-sm-3 mdui-col-sm-6 mdui-m-t-5  mdui-p-a-2">
            <div class="mdui-textfield mdui-textfield-floating-label">
                <i class="mdui-icon material-icons mdui-m-b-2">account_circle</i>
                <label class="mdui-textfield-label" >User Name</label>
                <input class="mdui-textfield-input" type="text" name="username" id="username" required/>
                <div class="mdui-textfield-error">用户名不能为空</div>
            </div>

            <div class="mdui-textfield mdui-textfield-floating-label mdui-m-b-4">
                <i class="mdui-icon material-icons mdui-m-b-2">lock</i>
                <label class="mdui-textfield-label">Password</label>
                <input class="mdui-textfield-input" type="password" name="password" id="pwd" required/>
                <div class="mdui-textfield-error">密码不能为空</div>
            </div>
            
            <div class="mdui-row">
                <button class="mdui-col-offset-xs-2 mdui-col-xs-2 mdui-btn mdui-ripple mdui-text-color-theme" id="regeister" onClick="register()">注册
                </button>
                <button class="mdui-col-offset-xs-4 mdui-col-xs-2 mdui-btn mdui-color-theme mdui-btn mdui-ripple mdui-shadow-1" id="submit" onClick="login()">
                    	登录
                </button>
            </div>
        </div>
    </div>
</div>
</body>

</html>